#include "process.h"
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define base 20
const double total = 1024.0;
const double once = 0.1;

void download(){
	srand(time(NULL));
	double curent = 0;
	int cnt = 0;
	while(curent < total){
	//	printf("test:%.1lf/%.1lf\r", curent, total);
	//	fflush(stdout);
		cnt ++;
		processbar(total, curent, cnt);	
		curent += (rand() % base + 1) * once;
		usleep(10000);
		if(curent > total) {
			curent = total;
			processbar(total,curent);
		}
	}
	printf("\n");
}

int main(){
	download();	
	//char p[] = ".\0...";
	//printf("%s\n",p);
	return 0;
}
